package com.ouwen.smartpay.domain;

import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.rpc.service.GenericService;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;
import java.util.Set;

/**
 *@author <a href="http://youngitman.tech">青年IT男</a>
 *@version v1.0.0
 *@className MetaDataWarpper
 *@description
 *@JunitTest: {@link  } 
 *@date 2020-04-23 23:02    
 *
 *
**/
@Setter
@Getter
@Builder
public class MetaDataWarpper {
    /*** 服务的版本 */
    private String version;
    /*** 服务的分组 */
    private String group;
    /*** 暴露的接口 */
    private Class<?> interfaceClass;
    /*** 暴露接口的方法 */
    private Set<String> methods;
    /*** 服务的远程调用对象 */
    private ReferenceConfig<GenericService> referenceConfig;

    private Set<ProviderWarpper> providerWarppers;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MetaDataWarpper that = (MetaDataWarpper) o;
        return Objects.equals(version, that.version) &&
                Objects.equals(group, that.group) &&
                Objects.equals(interfaceClass, that.interfaceClass);
    }

    @Override
    public int hashCode() {
        return Objects.hash(version, group, interfaceClass);
    }

    @Override
    public String toString() {
        return "MetaDataWarpper{" +
                "version='" + version + '\'' +
                ", group='" + group + '\'' +
                ", interfaceClass=" + interfaceClass +
                ", methods=" + methods +
                ", referenceConfig=" + referenceConfig +
                ", providerWarppers=" + providerWarppers +
                '}';
    }
}
